<script>
    function chuyenhuong(){
	window.location.href="?muc=nhom3&modul=tbl_donvi_ctdt&action=themdonvictdt";
    }
    function onCheckAll() {
        var x = document.getElementsByName('all');
        var y = document.getElementsByName('check');
        if (x[0].id == 'check') {
            x[0].id = 'uncheck';
            for (var i =0; i<y.length; i++) {
                y[i].checked = true; 
            } 
        }
        else if (x[0].id == 'uncheck') {
            x[0].id = 'check';
            for (var i =0; i<y.length; i++) {
                y[i].checked = false; 
            }
        }
    }
</script>
<div class="content-box"><!-- Start Content Box -->
    <!--------------------------------------------------------Content------------------------------------------->    	
	<div class="content-box-content">
        <form action="" method="POST" id="formnoidung" name="dulieu" >
        <div class="content-box-header"><h3>Danh Mục Đơn vị CTDT</h3></div>
        <table>
            <tr>
                <td></td>
            </tr>
            <tr>
                <td colspan="6">
                    <select name="madvtk">
    					<option value="0"> --------------Chọn mã Đơn vị--------------</option>
    					{foreach from=$ds_donvi item=dsdv}
    						<option value="{$dsdv->getma_donvi()}">{$dsdv->getma_donvi()} </option>
    					{/foreach}
 				    </select>
                    <select name="mactdttk">
    					<option value="0"> ------------Chọn mã CTDT------------</option>
    					{foreach from=$ds_ctdt item=ctdt}
    						<option value="{$ctdt->getma_ctdt()}">{$ctdt->getma_ctdt()} </option>
    					{/foreach}
				    </select>
                    <input type="submit" class="button" name="timkiem" value="Tìm Kiếm" />
                    <input type="button" class="button" name="themmoi" value="Thêm mới" onclick="chuyenhuong()" />
                </td>
            </tr>
            <tr>
                <th><input type="checkbox" id="check" name="all" onclick="onCheckAll();"/></th>
                <th>id DonVi_CTDT</th>
                <th>Mã CTDT</th>
                <th>Mã Đơn vị</th>
				<th>Ngày bắt đầu</th>
				<th>Tình trạng</th>
                <th colspan="2">Chức Năng</th>
            </tr>
            {foreach from=$ds_dv_ctdt item=dt}
                <tr>
                    <td class="cangiua"><input type="checkbox" name="check"/></td>
                    <td class="cangiua">{$dt->getid_dv_ctdt()}</td>
                    <td class="cangiua">{$dt->getma_ctdt()}</td>
                    <td class="cangiua">{$dt->getma_donvi()}</td>
					<td class="cangiua">{$dt->getngaybatdau()}</td>
					<td class="cangiua">{$dt->gettinhtrang()}</td>
                    <td ><a href="?muc=nhom3&modul=tbl_donvi_ctdt&action=suadonvictdt&id={$dt->getid_dv_ctdt()}">Edit</a></td>
                    <td><a onclick="return confirm('Bạn có chắc chắn muốn xóa??')" href="?muc=nhom3&modul=tbl_donvi_ctdt&action=xoadonvictdt&id={$dt->getid_dv_ctdt()}">Del</a></td>
                </tr>
            {/foreach }            
        </table>
        </form>
    </div> <!-- End .content-box-content -->
</div>